<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>分页索引号</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="bootstrap/css/bootstrap-table.min.css">
    <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">

    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询（media queries）功能 -->
    <!-- 警告：通过 file:// 协议（就是直接将 html 页面拖拽到浏览器中）访问页面时 Respond.js 不起作用 -->
    <!--[if lt IE 9]>
    <script src="bootstrap/js/html5shiv.min.js"></script>
    <script src="bootstrap/js/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<h1>使用选项控制分页的索引号。</h1>
<div class="toolbar">
    <div>
        <label>
            <code>paginationSuccessivelySize</code>
            <input type="number" value="5" min="1" class="form-control" id="paginationSuccessivelySize">
        </label>
    </div>
    <div>
        <label>
            <code>paginationPagesBySide</code>
            <input type="number" value="1" min="0" class="form-control" id="paginationPagesBySide">
        </label>
    </div>
    <div class="checkbox">
        <label>
            <input type="checkbox" id="paginationUseIntermediate">
            <code>paginationUseIntermediate</code>
        </label>
    </div>
</div>

<table
        id="table"
        data-toggle="table"
        data-toolbar=".toolbar"
        data-pagination="true"
        data-side-pagination="server"
        data-url="https://examples.wenzhixin.net.cn/examples/bootstrap_table/data">
    <thead>
    <tr>
        <th data-field="id">ID</th>
        <th data-field="name">Item Name</th>
        <th data-field="price">Item Price</th>
    </tr>
    </thead>
</table>

<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
<script src="bootstrap/js/jquery.min.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="bootstrap/js/bootstrap-table.min.js"></script>
<!-- Latest compiled and minified Locales -->
<script src="bootstrap/js/bootstrap-table-zh-CN.min.js"></script>
<script>
    var $table = $('#table')

    function refreshTable() {
        $table.bootstrapTable('refreshOptions', {
            paginationSuccessivelySize: +$('#paginationSuccessivelySize').val(),
            paginationPagesBySide: +$('#paginationPagesBySide').val(),
            paginationUseIntermediate: $('#paginationUseIntermediate').prop('checked')
        })
    }

    $(function() {
        $('.toolbar input').change(refreshTable)
    })
</script>
</body>
</html>